/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import { Project } from '../../../../external/core/hvigor-core-node.js';

import { AbstractExecutePipeline } from './abstract-execute-pipeline.js';
import { TaskExecuteOptions } from './execute-mode-factory.js';
import { ExecuteModulePipeline } from './execute-module-pipeline.js';
import { ExecuteProjectPipeline } from './execute-project-pipeline.js';

/**
 * 执行mode为undefined状态下的Pipeline
 *
 * @since 2022/6/20
 */
export class ExecuteUndefinedPipeline extends AbstractExecutePipeline {
  private projectPipeLine: ExecuteProjectPipeline;
  private modulePipeline: ExecuteModulePipeline;

  constructor(project: Project, taskOptions: TaskExecuteOptions) {
    super(project, taskOptions);
    this.projectPipeLine = new ExecuteProjectPipeline(project, taskOptions, false);
    this.modulePipeline = new ExecuteModulePipeline(project, taskOptions);
  }

  public findPipeAllNeedExecuteSyncTasks(): string[] {
    return [...this.modulePipeline.findPipeAllNeedExecuteSyncTasks(), ...this.projectPipeLine.findPipeAllNeedExecuteSyncTasks()];
  }

  public findPipeAllNeedExecuteTasks(): string[] {
    return [...this.modulePipeline.findPipeAllNeedExecuteTasks(), ...this.projectPipeLine.findPipeAllNeedExecuteTasks()];
  }
}
